<!-- 新增区域弹窗 -->
<template>
  <a-modal
    :maskClosable="false"
    title="选项内容"
    centered
    :destroyOnClose="true"
    :width="500"
    :footer="null"
    v-model="visible"
  >
    <div>
      <div class="_p-10" v-for="item in options" :key="item.id">{{ item.name }}</div>
      <div v-if="isInternalInterface === 2" class="_p-10">
        <a @click="info">联系官方运维添加字段</a>
      </div>
    </div>
  </a-modal>
</template>

<script>
import { memberTypeList } from '@/api/member/member'
export default {
  props: ['memberType'],
  components: {},
  data() {
    return {
      visible: false,
      options: [],
      isInternalInterface: 1,
    }
  },
  computed: {},
  watch: {},
  methods: {
    show(field) {
      this.isInternalInterface = field.isInternalInterface
      //接口
      if (field.isInternalInterface === 1) {
        this.getMemberTypeList(field.type)
      } else {
        //字典
        this.getDict(field.type)
      }
      this.visible = true
    },
    getMemberTypeList(type) {
      memberTypeList(type, { sceneType: 'memberApply', memberType: this.memberType }).then((res) => {
        this.options = res.data[type]
      })
    },
    getDict(type) {
      this.Dict.get(type).then((res) => {
        this.options = res.map((item) => {
          return {
            id: item.dictValue,
            name: item.dictLabel,
          }
        })
      })
    },
    info() {
      const h = this.$createElement
      this.$info({
        title: '联系官方运维',
        content: h('div', {}, [h('span', '联系官方运维请拨打：'), h('a', '18188616477')]),
        onOk() {},
      })
    },
  },
  created() {},
  mounted() {},
}
</script>
<style scoped>
</style>